const app = getApp()

Page({
  data: {

  },
  onLoad: function (options) {
    // 从个人中心的页面进入
    var openid = wx.getStorageSync('openID')
    var userInfo = wx.getStorageSync('userInfo')
    if (!userInfo) {
      this.setData({ authorize: false, signIn: true ,openid:openid})
    }
    else{
      this.setData({ authorize: true, signIn: false, openid: openid})
    }
      
  },

  getUserInfo: function(res){
    if (res.detail.userInfo) {
      wx.setStorageSync('userInfo', res.detail.userInfo)
      this.setData({ authorize: true, signIn: false })
      wx.navigateTo({
        url: '/pages/personal/personal?id=myself',
      })
    }
    else{
      wx.showModal({
        title: '提示',
        content: '请授权让我们获取用户信息，方便完善名片与人际沟通',
        showCancel:false
      })
    }
  },

  onShareAppMessage: function () {
    return {
      title: '校园互助，方便你我',
      path: 'pages/index/index',
      imageUrl:'/images/header-images/logo.jpg'
    }
  }
})
